<template>
  <div id="HomePage">
    <div class="carousel">
      <el-carousel indicator-position="outside" height="500px">
        <el-carousel-item
          v-for="(item, idx) in carouselData"
          :key="idx"
        >
          <div
            class="head-img"
            @click="toIndex"
            :style="{
              background: 'url(' + item.imgUrl + ') no-repeat',
              'background-size': '100% 500px' }"
          >
            <div class="carousel-title">
              {{ item.title_org }}
            </div>
          </div>
        </el-carousel-item>
      </el-carousel>
    </div>

    <!-- Case Start -->
    <div class="container-fluid bg-light py-5">
      <div class="container py-5">
        <div class="row g-4">
          <div
            class="col-lg-3 wow fadeIn"
            data-wow-delay="0.3s"
            v-for="(item,idx) in orientedData"
            :key="idx"
          >
            <div class="case-item position-relative overflow-hidden rounded mb-2">
              <img class="img-fluid" src="../assets/img/main-slider/project-1.jpg" alt="">
              <div class="case-overlay text-decoration-none" href="">
                <div class="card-title">{{item.orientedName}}</div>
                <h5 class="lh-base text-white mb-3">{{item.createTime}}</h5>
                <small class="to" @click="toDetail(item.id)">更多</small>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- Case End -->
  </div>
</template>
<script>
import '../assets/css/bootstrap.min.index.css'
import '../assets/css/owl.css'
import '../assets/css/responsive.css'
import {getAllOrientedData, getCarousel, getList, getOrientedData} from "../api/api";
export default {
  name: "HomePage",
  data() {
    return {
      orientedData: [],
      foodName: '',
      carouselData: [{
          imgUrl: require('../assets/img/main-slider/1.jpg'),
          title_org: ''
        },{
          imgUrl: require('../assets/img/main-slider/2.jpg'),
          title_org: ''
        },{
          imgUrl: require('../assets/img/main-slider/3.jpg'),
          title_org: ''
        }
      ],
    };
  },
  methods: {
    entryName (e) {
      this.foodName = e.target.value;
    },
    foodSelect () {
      if (!this.foodName) {
        return
      }
      this.$router.push({
        name: 'foodList',
        query: {
          foodName: this.foodName
        }
      })
    },
    toDetail(id){
      this.$router.push({
        name: 'technologyintroduction',
        query: {
          id: id
        }
      })
    },
    toIndex() {

    },
    linkTo (url) {
      this.$router.push({
        name: url,
        params: {}
      })
    }
  },
  mounted() {
    getList().then(res => {
      console.log('res', res)

    }).catch(err => {
      console.log(err)
    })

    getCarousel({
      retNum: 10
    }).then(res => {
      const data = res.data.data.slice(0,3)
      data.forEach((item, index) => {
        this.carouselData[index].title_org = data[index].title_org || ''
      });
      console.log('getCarousel', this.carouselData)

    }).catch(err => {
      console.log(err)
    })

    getOrientedData().then(res => {
      this.orientedData = res.data.rows
    }).catch(err => {
      console.log(err)
    })
  }
};
</script>
<style scoped>
.container-content {
  width: 350px;
}
.blog-post-thumbnail img {
  width: 350px;
  height: 204px;
}
.bord {
  height: 54px;
  border: 1px solid #1e1e1e;
  display: inline-block;
  padding: 0 20px;
  line-height: 52px;
  color: #1e1e1e;
  text-transform: uppercase;
  cursor: pointer;
}
.bord:hover {
  border: 1px solid #1363c6;
  -webkit-transition: all 500ms ease 0s;
  transition: all 500ms ease 0s;
  text-decoration: none;
  outline: none;
  color: #1363c6;
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
}
.tag-title {
  font-size: 14px;
  font-weight: 700;
  background-color: #1363c6;
  color: #fff;
  text-transform: uppercase;
  padding: 5px 10px;
  line-height: 1;
  letter-spacing: 1px;
  margin-bottom: 15px;
  display: inline-block;
  font-family: 'PT Serif', serif !important;
}
.container-list {
  display: flex;
  flex-direction: row;
  padding-top: 100px;
  max-width: 1320px;
  margin: 0 auto;
}
/* 整体盒子 */
#HomePage {
  width: 100%;
  height: 100%;
}
.carousel {
  margin-top: 69px;
  height: 500px;
}
.head-img {
  height: 100%;
  cursor: pointer;
}
.carousel-title {
  font-size: 40px;
  color: #FFFFFF;
  font-weight: 500;
  padding: 100px 0 0 300px;
}
.container-fluid {
  background-color: #f4f7fe !important;
}
.case-item img {
  transition: .5s;
}

.case-item:hover img {
  transform: scale(1.2);
}

.case-overlay {
  position: absolute;
  padding: 30px;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(rgba(20, 24, 62, 0), #000000);
  z-index: 1;
}

.case-overlay .card-title {
  color: #FFFFFF;
  font-weight: 600;
  font-size: 25px;
}

.case-overlay small {
  display: inline-block;
  padding: 3px 15px;
  color: rgb(19, 99, 198);
  background: #FFFFFF;
  border-radius: 25px;
  margin-bottom: 15px;
  margin-left: 180px;
}

.case-overlay span.btn:hover {
  color: var(--primary);
  background: #FFFFFF;
  border-color: #FFFFFF;
}
.btn {
  font-weight: 500;
  transition: .5s;
}

.btn-square {
  width: 38px;
  height: 38px;
}

.btn-sm-square {
  width: 32px;
  height: 32px;
}

.btn-lg-square {
  width: 48px;
  height: 48px;
}

.btn-square,
.btn-sm-square,
.btn-lg-square {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: normal;
  border-radius: 50px;
}
.text-decoration-none {
  cursor: pointer;
}

.news-section {
  position: relative;
  padding: 110px 0px;
  background: #ffffff;
  overflow: hidden;
}

.news-block {
  position: relative;
  margin-bottom: 30px;
}

.owl-theme .news-block {
  margin-bottom: 0;
}

.news-section .news-carousel .owl-stage-outer {
  overflow: visible;
}

.news-section .news-carousel .news-block {
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -webkit-transition: all 0.3s ease;
  -ms-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
}

.news-section .news-carousel .active .news-block {
  opacity: 1;
  visibility: visible;
}

.news-block .inner-box {
  position: relative;
  display: block;
}

.news-block .image-box {
  position: relative;
  display: block;
  overflow: hidden;
  z-index: 1;
}

.news-block .image,
.news-block .image img {
  display: block;
  width: 100%;
}

.news-block .hover-box {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.0);
  color: #dedede;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
  -webkit-transition: all 0.5s ease;
  -ms-transition: all 0.5s ease;
  -o-transition: all 0.5s ease;
}

.news-block .inner-box:hover .hover-box {
  opacity: 1;
  visibility: visible;
}

.news-block .hover-box .link {
  position: absolute;
  left: 0;
  top: 0;
  width: 50%;
  height: 100%;
  background: rgba(0, 0, 0, 0.0);
  color: #ffffff;
  transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
  -webkit-transition: all 0.5s ease;
  -ms-transition: all 0.5s ease;
  -o-transition: all 0.5s ease;
}

.news-block .hover-box .link a {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.80);
  color: #ffffff;
  text-align: center;
  transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
  -webkit-transition: all 0.5s ease;
  -ms-transition: all 0.5s ease;
  -o-transition: all 0.5s ease;
}

.news-block .hover-box .link a .icon {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 30px;
  line-height: 30px;
  width: 30px;
  text-align: center;
  margin: -15px 0px 0px -15px;
}

.news-block .hover-box .single-link {
  left: auto;
  right: 0;
}

.news-block .hover-box .single-link a {
  background: #00aa55;
}

.news-block .lower-box {
  position: relative;
  display: block;
  padding: 30px 30px 20px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-top: none;
  font-family: 'Manjari', sans-serif;
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.07);
}

.news-block .lower-box .upper-info {
  position: relative;
  padding-bottom: 20px;
}

.news-block .lower-box h4 {
  position: relative;
  margin-bottom: 12px;
  font-weight: 700;
  z-index: 1;
}

.news-block .lower-box h4 a {
  color: #222222;
  transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -webkit-transition: all 0.3s ease;
  -ms-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
}

.news-block .lower-box h4 a:hover {
  color: #00aa55;
  text-decoration: underline;
}

.news-block .lower-box .cat-info {
  position: relative;
  color: #757575;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 14px;
  transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -webkit-transition: all 0.3s ease;
  -ms-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  z-index: 1;
}

.news-block .lower-box .cat-info a {
  color: #757575;
}

.news-block .lower-box .cat-info .fa {
  padding-right: 5px;
  font-size: 14px;
  color: #00aa55;
}

.news-block .lower-box .meta-info {
  position: relative;
  border-top: 1px solid rgba(0, 0, 0, 0.10);
  padding-top: 20px;
}

.news-block .author-info {
  position: relative;
  float: left;
  padding-left: 65px;
  min-height: 50px;
  padding-top: 8px;
}

.news-block .author-info .author-icon {
  position: absolute;
  left: 0;
  top: 0;
  width: 50px;
  height: 50px;
  line-height: 50px;
  text-align: center;
  font-size: 18px;
  color: #959595;
  background: #f1f1f1;
  border-radius: 50%;
}

.news-block .author-info .author-title {
  font-size: 14px;
  line-height: 20px;
  color: #222222;
  text-transform: uppercase;
  font-weight: 600;
}

.news-block .author-info .date {
  font-size: 14px;
  line-height: 20px;
  color: #757575;
  text-transform: uppercase;
}

.news-block .comments-info {
  position: relative;
  float: right;
  padding: 13px 0px;
  line-height: 24px;
  border-left: 1px solid rgba(0, 0, 0, 0.10);
  padding-left: 15px;
}

.news-block .comments-info a {
  font-size: 14px;
  color: #757575;
  display: block;
}

.news-block .comments-info a .fa {
  padding-right: 3px;
  color: #aaaaaa;
}

.news-carousel .owl-nav {
  position: absolute;
  right: 0;
  top: -122px;
}

.news-carousel .owl-nav button.owl-next,
.news-carousel .owl-nav button.owl-prev {
  position: relative;
  display: inline-block;
  vertical-align: top;
  margin-left: 10px;
  width: 62px;
  height: 62px;
  line-height: 60px;
  color: #cccccc;
  font-size: 24px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  text-align: center;
  transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -webkit-transition: all 0.3s ease;
  -ms-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
}

.news-carousel .owl-nav .owl-next:hover,
.news-carousel .owl-nav .owl-prev:hover {
  border-color: #00aa55;
  color: #00aa55;
}

.news-carousel .owl-dots {
  position: relative;
  display: block;
  padding-top: 40px;
  width: 100%;
  text-align: center;
  display: none;
}

.news-carousel .owl-dots .owl-dot {
  position: relative;
  display: inline-block;
  margin: 0px 10px;
}

.news-carousel .owl-dots .owl-dot span {
  position: relative;
  display: block;
  width: 3px;
  height: 3px;
  background: #aaaaaa;
  outline: 2px solid rgba(0, 0, 0, 0);
  outline-offset: 4px;
}

.news-carousel .owl-dots .owl-dot.active span {
  background: #00aa55;
  outline-color: #00aa55;
}

</style>

